#ifndef f_gsm_audio_decoder_h_
#define f_gsm_audio_decoder_h_

#include "CAudioDecoder.h"
#include "CAudioResampler.h"

extern "C"
{
#	include "../../Audio/GSM0610/inc/gsm.h"
}

class CGSMAudioDecoder: public CAudioDecoder
{
public:
	CGSMAudioDecoder();
	virtual ~CGSMAudioDecoder();

	virtual const WAVEFORMATEX& Format() const;
	virtual DWORD Decode(BYTE *from, BYTE *to);

	virtual bool Open(const WAVEFORMATEX & required_format);
	virtual long StreamLen() const { return m_stream_len; }
private:
	WAVEFORMATEX m_format;
	WAVEFORMATEX m_required;

	gsm m_handle;
	CAudioResampler *m_resampler;

	BYTE *m_stream;
	long m_stream_len;

	bool m_bUseResampler;

	bool IsNeedResampler();
};

#endif